package utils;
import rp.account.Account;

import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class JDBC {
    private Statement statement;

    public JDBC(String url,String name,String pass) throws Exception{
        Class.forName("com.mysql.jdbc.Driver");
        statement = DriverManager.getConnection(url, name, pass).createStatement();
    }

    public ResultSet get(String sql) throws Exception{
        return statement.executeQuery(sql);
    }
    public Integer set(String sql) throws Exception{
        return statement.executeUpdate(sql);
    }
    public Boolean add(String sql) throws Exception{
        return statement.execute(sql);
    }
    public Boolean del(String sql) throws Exception{
        return statement.execute(sql);
    }
    public void execute(String sql) throws Exception{
        statement.execute(sql);
    }
    /*
    public Boolean addAccount(Account account){
        String sql = "insert into user ( name, field2,...fieldN )values( value1, value2,...valueN )";
    }*/
}
